<?php
/**
 * User: lie
 * Date: 2020/12/3 16:27
 * Title: 统计帖子的字节数
 * Description:
 * Error:
 */
function unhtml($conten) {
    $conten = htmlspecialchars($conten);
    var_dump($conten);
    $conten = str_replace(chr(13), '<br>', $conten);
    var_dump($conten);
    $conten = str_replace(chr(32), '&nbsp;', $conten);
    return trim($conten);
}
$str = '标题：PHP编程宝典<br>内容：PHP编程宝典非常好';

?>
<table border="1" cellpadding="0" cellspacing="0">
    <tr>
        <td><?php echo $str;?></td>
    </tr>
</table>
<?php echo "共有字节：".strlen(unhtml($str)). '个'; ?>
